package pub.guoxin.oops.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.querydsl.core.annotations.QueryEntity;
import lombok.*;
import org.mongodb.morphia.annotations.Entity;
import pub.guoxin.oops.enums.ComparisonOperator;

@Builder
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@QueryEntity
@JsonInclude(JsonInclude.Include.NON_NULL)
@NoArgsConstructor
@AllArgsConstructor
public class AlarmInfo extends BaseEntity0<String> {

    /**
     * 报警处理ID
     */
    private String alarmDisposeId;
    /**
     * 公司Id
     */
    private String companyId;
    /**
     * 分组Id
     */
    private String groupId;
    /**
     * 通讯模块sn
     */
    private String communicationSn;

    /**
     * 设备sn
     */
    private String deviceSn;
    /**
     *
     */
    private String fieldName;
    /**
     * 比较
     */
    private String comparisonOperator;
    /**
     *
     */
    private Object value;
    /**
     * 报警信息
     */
    private String content;

    public AlarmInfo(String companyId, String fieldName, String deviceSn, String communicationSn, ComparisonOperator comparisonOperator, String value, String content) {
        this.fieldName = fieldName;
        this.communicationSn = communicationSn;
        this.comparisonOperator = comparisonOperator.getValue();
    }
}
